/******************************************************************************* * Copyright (c) 2012, Project: FP7-ICT-257930 Aniketos * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * * - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * - Neither the name of institution nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ /** */ package eu.aniketos.mtm.model.mtm_di.impl; import eu.aniketos.mtm.model.mtm_di.DiPackage; import eu.aniketos.mtm.model.mtm_di.DiagramElement; import eu.aniketos.mtm.model.mtm_di.ExtensionType; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.notify.NotificationChain; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.emf.ecore.impl.EObjectImpl; import org.eclipse.emf.ecore.util.BasicFeatureMap; import org.eclipse.emf.ecore.util.FeatureMap; import org.eclipse.emf.ecore.util.InternalEList; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Diagram Element</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link eu.aniketos.mtm.model.mtm_di.impl.DiagramElementImpl#getExtension <em>Extension</em>}</li> * <li>{@link eu.aniketos.mtm.model.mtm_di.impl.DiagramElementImpl#getId <em>Id</em>}</li> * <li>{@link eu.aniketos.mtm.model.mtm_di.impl.DiagramElementImpl#getAnyAttribute <em>Any Attribute</em>}</li> * </ul> * </p> * * @generated */ public abstract class DiagramElementImpl extends EObjectImpl implements DiagramElement { /** * The cached value of the '{@link #getExtension() <em>Extension</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getExtension() * @generated * @ordered */ protected ExtensionType extension; /** * The default value of the '{@link #getId() <em>Id</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getId() * @generated * @ordered */ protected static final String ID_EDEFAULT = null; /** * The cached value of the '{@link #getId() <em>Id</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getId() * @generated * @ordered */ protected String id = ID_EDEFAULT; /** * The cached value of the '{@link #getAnyAttribute() <em>Any Attribute</em>}' attribute list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getAnyAttribute() * @generated * @ordered */ protected FeatureMap anyAttribute; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected DiagramElementImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return DiPackage.Literals.DIAGRAM_ELEMENT; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public ExtensionType getExtension() { return extension; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetExtension(ExtensionType newExtension, NotificationChain msgs) { ExtensionType oldExtension = extension; extension = newExtension; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, DiPackage.DIAGRAM_ELEMENT__EXTENSION, oldExtension, newExtension); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setExtension(ExtensionType newExtension) { if (newExtension != extension) { NotificationChain msgs = null; if (extension != null) msgs = ((InternalEObject)extension).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - DiPackage.DIAGRAM_ELEMENT__EXTENSION, null, msgs); if (newExtension != null) msgs = ((InternalEObject)newExtension).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - DiPackage.DIAGRAM_ELEMENT__EXTENSION, null, msgs); msgs = basicSetExtension(newExtension, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, DiPackage.DIAGRAM_ELEMENT__EXTENSION, newExtension, newExtension)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getId() { return id; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setId(String newId) { String oldId = id; id = newId; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, DiPackage.DIAGRAM_ELEMENT__ID, oldId, id)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public FeatureMap getAnyAttribute() { if (anyAttribute == null) { anyAttribute = new BasicFeatureMap(this, DiPackage.DIAGRAM_ELEMENT__ANY_ATTRIBUTE); } return anyAttribute; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case DiPackage.DIAGRAM_ELEMENT__EXTENSION: return basicSetExtension(null, msgs); case DiPackage.DIAGRAM_ELEMENT__ANY_ATTRIBUTE: return ((InternalEList<?>)getAnyAttribute()).basicRemove(otherEnd, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case DiPackage.DIAGRAM_ELEMENT__EXTENSION: return getExtension(); case DiPackage.DIAGRAM_ELEMENT__ID: return getId(); case DiPackage.DIAGRAM_ELEMENT__ANY_ATTRIBUTE: if (coreType) return getAnyAttribute(); return ((FeatureMap.Internal)getAnyAttribute()).getWrapper(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case DiPackage.DIAGRAM_ELEMENT__EXTENSION: setExtension((ExtensionType)newValue); return; case DiPackage.DIAGRAM_ELEMENT__ID: setId((String)newValue); return; case DiPackage.DIAGRAM_ELEMENT__ANY_ATTRIBUTE: ((FeatureMap.Internal)getAnyAttribute()).set(newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case DiPackage.DIAGRAM_ELEMENT__EXTENSION: setExtension((ExtensionType)null); return; case DiPackage.DIAGRAM_ELEMENT__ID: setId(ID_EDEFAULT); return; case DiPackage.DIAGRAM_ELEMENT__ANY_ATTRIBUTE: getAnyAttribute().clear(); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case DiPackage.DIAGRAM_ELEMENT__EXTENSION: return extension != null; case DiPackage.DIAGRAM_ELEMENT__ID: return ID_EDEFAULT == null ? id != null : !ID_EDEFAULT.equals(id); case DiPackage.DIAGRAM_ELEMENT__ANY_ATTRIBUTE: return anyAttribute != null && !anyAttribute.isEmpty(); } return super.eIsSet(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { if (eIsProxy()) return super.toString(); StringBuffer result = new StringBuffer(super.toString()); result.append(" (id: "); result.append(id); result.append(", anyAttribute: "); result.append(anyAttribute); result.append(')'); return result.toString(); } } //DiagramElementImpl